package com.ymatou.iapi.liveseller.service;

import java.util.ArrayList;

import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.liveseller.parameter.LiveActivityListDto;
import com.ymatou.iapi.liveseller.parameter.LiveActivityProductDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*通过商品id列表查询所有活动商品状态
*FreeMaker Template自动生成代码
*/
public class GetLiveActivityProductsByPidsCall extends YmatouBaseCall{
	private static String opurl ="api/live/GetLiveActivityProductsByPids";
	
	public GetLiveActivityProductsByPidsCall() {
		super(EnvSetup.getSystemUrl("liveseller_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public ArrayList<LiveActivityListDto> getLiveProductActivityList()
    {
		ArrayList<LiveActivityListDto> data = null;
        try {
        	String liveroominfo=getJsonObject().get("Data").getAsJsonObject().get("LiveProductActivityList").getAsJsonArray().toString();
        	data=(ArrayList<LiveActivityListDto>) FormatUtil.GSONToObject(liveroominfo, new TypeToken<ArrayList<LiveActivityListDto>>() {}.getType());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}